﻿using System.Drawing;
using System;
namespace Tal.CaptchaControl
{
    /// <summary>
    /// Summary description for ImageGenerator
    /// </summary>
    public abstract class ImageGenerator
    {
        private string _fontFamily;
        public string FontFamily
        {
            get
            {
                if (_fontFamily == null)
                {
                    return "Arial";
                }
                else
                {
                    return _fontFamily;
                }
            }
            set
            {
                _fontFamily = value;
            }
        }
        private int? _imageHeight;
        /// <summary>
        /// Gets or sets the height of the captcha image
        /// </summary>
        public int ImageHeight
        {
            get
            {
                if (!_imageHeight.HasValue)
                {
                    return 70;
                }
                else
                {
                    return _imageHeight.Value;
                }
            }
            set
            {
                _imageHeight = value;
            }
        }
        private int? _imageWidth;
        /// <summary>
        /// Gets or sets the width of the captcha image
        /// </summary>
        public int ImageWidth
        {
            get
            {
                if (!_imageWidth.HasValue)
                {
                    return 200;
                }
                else
                {
                    return _imageWidth.Value;
                }
            }
            set
            {
                _imageWidth = value;
            }
        }

        private string _imageText;
        /// <summary>
    /// Gets the text on the current image
    /// </summary>
        public string ImageText
        {
            get
            {
                return _imageText;
            }
        }

        public ImageGenerator(string imageText)
        {
            this._imageText = imageText;
        }

        public abstract Bitmap GenerateImage();
        
    }
}